%% This function is to calculate power loss and minimum voltage for 119 nodes test system
% 	Input:
%				- chorm
%		Output
%				- power_loss 
%				- min_v
%		Kaifeng Yang, Feb. 19, 2014
%       This function need the platform of MATPOWER by Ray D. Zimmerman, Carlos E. Murillo-Sánchez & Deqiang (David) Gan
%		http://www.pserc.cornell.edu//matpower/
function power_loss = calculation_119(chorm)
mpc.version = '2';

%%-----  Power Flow Data  -----%%
%% system MVA base
mpc.baseMVA = 1;

%% bus data
%	bus_i	type	Pd	Qd	Gs	Bs	area	Vm	Va	baseKV	zone	Vmax	Vmin
mpc.bus = [
1	3	0	0	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
2	1	0.133840000000000	0.101140000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
3	1	0.0162140000000000	0.0112920000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
4	1	0.0343150000000000	0.0218450000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
5	1	0.0730160000000000	0.0636020000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
6	1	0.144200000000000	0.0686040000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
7	1	0.104470000000000	0.0617250000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
8	1	0.0285470000000000	0.0115030000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
9	1	0.0875600000000000	0.0510730000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
10	1	0.198200000000000	0.106770000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
11	1	0.146800000000000	0.0759950000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
12	1	0.0260400000000000	0.0186870000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
13	1	0.0521000000000000	0.0232200000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
14	1	0.141900000000000	0.117500000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
15	1	0.0218700000000000	0.0287900000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
16	1	0.0333700000000000	0.0264500000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
17	1	0.0324300000000000	0.0252300000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
18	1	0.0202340000000000	0.0119060000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
19	1	0.156940000000000	0.0785230000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
20	1	0.546290000000000	0.351400000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
21	1	0.180310000000000	0.164200000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
22	1	0.0931670000000000	0.0545940000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
23	1	0.0851800000000000	0.0396500000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
24	1	0.168100000000000	0.0951780000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
25	1	0.125110000000000	0.150220000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
26	1	0.0160300000000000	0.0246200000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
27	1	0.0260300000000000	0.0246200000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
28	1	0.594560000000000	0.522620000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
29	1	0.120620000000000	0.0591170000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
30	1	0.102380000000000	0.0995540000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
31	1	0.513400000000000	0.318500000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
32	1	0.475250000000000	0.456140000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
33	1	0.151430000000000	0.136790000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
34	1	0.205380000000000	0.0833020000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
35	1	0.131600000000000	0.0930820000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
36	1	0.448400000000000	0.369790000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
37	1	0.440520000000000	0.321640000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
38	1	0.112540000000000	0.0551340000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
39	1	0.0539630000000000	0.0389980000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
40	1	0.393050000000000	0.342600000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
41	1	0.326740000000000	0.278560000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
42	1	0.536260000000000	0.240240000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
43	1	0.0762470000000000	0.0665620000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
44	1	0.0535200000000000	0.0397600000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
45	1	0.0403280000000000	0.0319640000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
46	1	0.0396530000000000	0.0207580000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
47	1	0.0661950000000000	0.0423610000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
48	1	0.0739040000000000	0.0516530000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
49	1	0.114770000000000	0.0579650000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
50	1	0.918370000000000	1.20510000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
51	1	0.210300000000000	0.146660000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
52	1	0.0666800000000000	0.0566080000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
53	1	0.0422070000000000	0.0401840000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
54	1	0.433740000000000	0.283410000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
55	1	0.0621000000000000	0.0268600000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
56	1	0.0924600000000000	0.0883800000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
57	1	0.0851880000000000	0.0554360000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
58	1	0.345300000000000	0.332400000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
59	1	0.0225000000000000	0.0168300000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
60	1	0.0805510000000000	0.0491560000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
61	1	0.0958600000000000	0.0907580000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
62	1	0.0629200000000000	0.0477000000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
63	1	0.478800000000000	0.463740000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
64	1	0.120940000000000	0.0520060000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
65	1	0.139110000000000	0.100340000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
66	1	0.391780000000000	0.193500000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
67	1	0.0277410000000000	0.0267130000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
68	1	0.0528140000000000	0.0252570000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
69	1	0.0668900000000000	0.0387130000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
70	1	0.467500000000000	0.395140000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
71	1	0.594850000000000	0.239740000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
72	1	0.132500000000000	0.0843630000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
73	1	0.0526990000000000	0.0224820000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
74	1	0.869790000000000	0.614775000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
75	1	0.0313490000000000	0.0298170000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
76	1	0.192390000000000	0.122430000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
77	1	0.0657500000000000	0.0453700000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
78	1	0.238150000000000	0.223220000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
79	1	0.294550000000000	0.162470000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
80	1	0.485570000000000	0.437920000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
81	1	0.243530000000000	0.183030000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
82	1	0.243530000000000	0.183030000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
83	1	0.134250000000000	0.119290000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
84	1	0.0227100000000000	0.0279600000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
85	1	0.0495130000000000	0.0265150000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
86	1	0.383780000000000	0.257160000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
87	1	0.0496400000000000	0.0206000000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
88	1	0.0224730000000000	0.0118060000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
89	1	0.0629300000000000	0.0429600000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
90	1	0.0306700000000000	0.0349300000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
91	1	0.0625300000000000	0.0667900000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
92	1	0.114570000000000	0.0817480000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
93	1	0.0812920000000000	0.0665260000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
94	1	0.0317330000000000	0.0159600000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
95	1	0.0333200000000000	0.0604800000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
96	1	0.531280000000000	0.224850000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
97	1	0.507030000000000	0.367420000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
98	1	0.0263900000000000	0.0117000000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
99	1	0.0459900000000000	0.0303920000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
100	1	0.100660000000000	0.0475720000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
101	1	0.456480000000000	0.350300000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
102	1	0.522560000000000	0.449290000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
103	1	0.408430000000000	0.168460000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
104	1	0.141480000000000	0.134250000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
105	1	0.104430000000000	0.0660240000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
106	1	0.0967930000000000	0.0836470000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
107	1	0.493920000000000	0.419340000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
108	1	0.225380000000000	0.135880000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
109	1	0.509210000000000	0.387210000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
110	1	0.188500000000000	0.173460000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
111	1	0.918030000000000	0.898550000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
112	1	0.305080000000000	0.215370000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
113	1	0.0543800000000000	0.0409700000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
114	1	0.211140000000000	0.192900000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
115	1	0.0670090000000000	0.0533360000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
116	1	0.162070000000000	0.0903210000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
117	1	0.0487850000000000	0.0291560000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
118	1	0.0339000000000000	0.0189800000000000	0	0	1	1	0	11	1	1.05000000000000	0.950000000000000
];
%% generator data
%	bus	Pg	Qg	Qmax	Qmin	Vg	mBase	status	Pmax	Pmin	Pc1	Pc2	Qc1min	Qc1max	Qc2min	Qc2max	ramp_agc	ramp_10	ramp_30	ramp_q	apf
mpc.gen = [
	1	20	20	100	-100	1 1 1	100	0	0	0	0	0	0	0	0	0	0	0	0;
];

%% branch data
%	fbus	tbus	r	x	b	rateA	rateB	rateC	ratio	angle	status	angmin	angmax
mpc.branch =[
1	2	0.0002975	0.0001074	0	100	100	100	0	0	1	-360	360
2	3	0.0002727	0.0000983	0	100	100	100	0	0	1	-360	360
2	4	0.0003719	0.0001339	0	100	100	100	0	0	1	-360	360
4	5	0.0001240	0.0004463	0	100	100	100	0	0	1	-360	360
5	6	0.0001240	0.0004463	0	100	100	100	0	0	1	-360	360
6	7	0.0001240	0.0001033	0	100	100	100	0	0	1	-360	360
7	8	0.0001488	0.0001157	0	100	100	100	0	0	1	-360	360
8	9	0.0001736	0.0005207	0	100	100	100	0	0	1	-360	360
2	10	0.0013719	0.0011107	0	100	100	100	0	0	1	-360	360
10	11	0.0009256	0.0006521	0	100	100	100	0	0	1	-360	360
11	12	0.0015455	0.0025868	0	100	100	100	0	0	1	-360	360
12	13	0.0011736	0.0012496	0	100	100	100	0	0	1	-360	360
13	14	0.0014876	0.0009752	0	100	100	100	0	0	1	-360	360
14	15	0.0012397	0.0003719	0	100	100	100	0	0	1	-360	360
15	16	0.0013223	0.0014876	0	100	100	100	0	0	1	-360	360
16	17	0.0012975	0.0014132	0	100	100	100	0	0	1	-360	360
11	18	0.0018017	0.0023554	0	100	100	100	0	0	1	-360	360
18	19	0.0009752	0.0015289	0	100	100	100	0	0	1	-360	360
19	20	0.0013223	0.0016198	0	100	100	100	0	0	1	-360	360
20	21	0.0009917	0.0015620	0	100	100	100	0	0	1	-360	360
21	22	0.0009917	0.0006521	0	100	100	100	0	0	1	-360	360
22	23	0.0116529	0.0059752	0	100	100	100	0	0	1	-360	360
23	24	0.0024215	0.0011140	0	100	100	100	0	0	1	-360	360
24	25	0.0010992	0.0008595	0	100	100	100	0	0	1	-360	360
25	26	0.0014711	0.0011074	0	100	100	100	0	0	1	-360	360
26	27	0.0014711	0.0011074	0	100	100	100	0	0	1	-360	360
4	28	0.0001240	0.0002446	0	100	100	100	0	0	1	-360	360
28	29	0.0000992	0.0002281	0	100	100	100	0	0	1	-360	360
29	30	0.0009917	0.0022860	0	100	100	100	0	0	1	-360	360
30	31	0.0017355	0.0020083	0	100	100	100	0	0	1	-360	360
31	32	0.0009917	0.0004463	0	100	100	100	0	0	1	-360	360
32	33	0.0014711	0.0019339	0	100	100	100	0	0	1	-360	360
33	34	0.0014711	0.0019339	0	100	100	100	0	0	1	-360	360
34	35	0.0012727	0.0013388	0	100	100	100	0	0	1	-360	360
30	36	0.0015455	0.0021570	0	100	100	100	0	0	1	-360	360
36	37	0.0010992	0.0008182	0	100	100	100	0	0	1	-360	360
29	38	0.0027273	0.0016033	0	100	100	100	0	0	1	-360	360
38	39	0.0025620	0.0016033	0	100	100	100	0	0	1	-360	360
39	40	0.0010744	0.0016033	0	100	100	100	0	0	1	-360	360
40	41	0.0023140	0.0012397	0	100	100	100	0	0	1	-360	360
41	42	0.0097521	0.0070248	0	100	100	100	0	0	1	-360	360
42	43	0.0034711	0.0020132	0	100	100	100	0	0	1	-360	360
43	44	0.0022314	0.0008033	0	100	100	100	0	0	1	-360	360
44	45	0.0028017	0.0010091	0	100	100	100	0	0	1	-360	360
45	46	0.0022314	0.0014702	0	100	100	100	0	0	1	-360	360
35	47	0.0017355	0.0011430	0	100	100	100	0	0	1	-360	360
47	48	0.0009917	0.0006521	0	100	100	100	0	0	1	-360	360
48	49	0.0012397	0.0008157	0	100	100	100	0	0	1	-360	360
49	50	0.0012397	0.0008157	0	100	100	100	0	0	1	-360	360
50	51	0.0019835	0.0013066	0	100	100	100	0	0	1	-360	360
51	52	0.0009917	0.0006521	0	100	100	100	0	0	1	-360	360
52	53	0.0033471	0.0012050	0	100	100	100	0	0	1	-360	360
53	54	0.0033471	0.0012050	0	100	100	100	0	0	1	-360	360
29	55	0.0032314	0.0011653	0	100	100	100	0	0	1	-360	360
55	56	0.0033554	0.0012074	0	100	100	100	0	0	1	-360	360
56	57	0.0033554	0.0012074	0	100	100	100	0	0	1	-360	360
57	58	0.0058347	0.0045132	0	100	100	100	0	0	1	-360	360
58	59	0.0027934	0.0010066	0	100	100	100	0	0	1	-360	360
59	60	0.0027934	0.0010066	0	100	100	100	0	0	1	-360	360
60	61	0.0017107	0.0006174	0	100	100	100	0	0	1	-360	360
61	62	0.0020413	0.0073736	0	100	100	100	0	0	1	-360	360
1	63	0.0002314	0.0003455	0	100	100	100	0	0	1	-360	360
63	64	0.0009669	0.0016661	0	100	100	100	0	0	1	-360	360
64	65	0.0021074	0.0007587	0	100	100	100	0	0	1	-360	360
65	66	0.0017355	0.0006273	0	100	100	100	0	0	1	-360	360
66	67	0.0031653	0.0011405	0	100	100	100	0	0	1	-360	360
67	68	0.0041653	0.0027298	0	100	100	100	0	0	1	-360	360
68	69	0.0033554	0.0012074	0	100	100	100	0	0	1	-360	360
69	70	0.0079504	0.0062893	0	100	100	100	0	0	1	-360	360
70	71	0.0013636	0.0004959	0	100	100	100	0	0	1	-360	360
71	72	0.0025041	0.0009025	0	100	100	100	0	0	1	-360	360
72	73	0.0025041	0.0009025	0	100	100	100	0	0	1	-360	360
73	74	0.0017025	0.0011901	0	100	100	100	0	0	1	-360	360
74	75	0.0019256	0.0006942	0	100	100	100	0	0	1	-360	360
75	76	0.0048843	0.0014653	0	100	100	100	0	0	1	-360	360
76	77	0.0010413	0.0003744	0	100	100	100	0	0	1	-360	360
64	78	0.0046198	0.0030471	0	100	100	100	0	0	1	-360	360
78	79	0.0015372	0.0010140	0	100	100	100	0	0	1	-360	360
79	80	0.0015372	0.0010140	0	100	100	100	0	0	1	-360	360
80	81	0.0021488	0.0011488	0	100	100	100	0	0	1	-360	360
81	82	0.0012727	0.0012231	0	100	100	100	0	0	1	-360	360
82	83	0.0019008	0.0010579	0	100	100	100	0	0	1	-360	360
83	84	0.0020826	0.0008760	0	100	100	100	0	0	1	-360	360
84	85	0.0014876	0.0012231	0	100	100	100	0	0	1	-360	360
79	86	0.0013223	0.0015041	0	100	100	100	0	0	1	-360	360
86	87	0.0016529	0.0019008	0	100	100	100	0	0	1	-360	360
87	88	0.0013223	0.0032479	0	100	100	100	0	0	1	-360	360
65	89	0.0055289	0.0019934	0	100	100	100	0	0	1	-360	360
89	90	0.0021983	0.0010140	0	100	100	100	0	0	1	-360	360
90	91	0.0021983	0.0010140	0	100	100	100	0	0	1	-360	360
91	92	0.0021983	0.0010140	0	100	100	100	0	0	1	-360	360
92	93	0.0021983	0.0010140	0	100	100	100	0	0	1	-360	360
93	94	0.0019256	0.0009504	0	100	100	100	0	0	1	-360	360
94	95	0.0040992	0.0011405	0	100	100	100	0	0	1	-360	360
91	96	0.0016198	0.0014876	0	100	100	100	0	0	1	-360	360
96	97	0.0016198	0.0014876	0	100	100	100	0	0	1	-360	360
97	98	0.0015421	0.0010083	0	100	100	100	0	0	1	-360	360
98	99	0.0006165	0.0026281	0	100	100	100	0	0	1	-360	360
1	100	0.0005165	0.0002190	0	100	100	100	0	0	1	-360	360
100	101	0.0012405	0.0019339	0	100	100	100	0	0	1	-360	360
101	102	0.0011132	0.0007339	0	100	100	100	0	0	1	-360	360
102	103	0.0019066	0.0009942	0	100	100	100	0	0	1	-360	360
103	104	0.0036942	0.0013289	0	100	100	100	0	0	1	-360	360
104	105	0.0013488	0.0004860	0	100	100	100	0	0	1	-360	360
105	106	0.0027273	0.0008182	0	100	100	100	0	0	1	-360	360
106	107	0.0012893	0.0004636	0	100	100	100	0	0	1	-360	360
107	108	0.0031562	0.0011355	0	100	100	100	0	0	1	-360	360
108	109	0.0013438	0.0004835	0	100	100	100	0	0	1	-360	360
109	110	0.0031562	0.0011355	0	100	100	100	0	0	1	-360	360
110	111	0.0020207	0.0007264	0	100	100	100	0	0	1	-360	360
110	112	0.0017256	0.0006223	0	100	100	100	0	0	1	-360	360
112	113	0.0019017	0.0006843	0	100	100	100	0	0	1	-360	360
100	114	0.0050430	0.0018149	0	100	100	100	0	0	1	-360	360
114	115	0.0015421	0.0010496	0	100	100	100	0	0	1	-360	360
115	116	0.0030843	0.0020331	0	100	100	100	0	0	1	-360	360
116	117	0.0033471	0.0030331	0	100	100	100	0	0	1	-360	360
117	118	0.0040413	0.0036198	0	100	100	100	0	0	1	-360	360

46	27	0.0043455	0.0024174	0	100	100	100	0	0	1	-360	360
17	27	0.0043455	0.0024099	0	100	100	100	0	0	1	-360	360
8	24  0.0035306	0.0012719	0	100	100	100	0	0	1	-360	360
54	43	0.0039669	0.0014281	0	100	100	100	0	0	1	-360	360
62	49	0.0029752	0.0010711	0	100	100	100	0	0	1	-360	360
37	62	0.0047107	0.0047273	0	100	100	100	0	0	1	-360	360
9	40	0.0043802	0.0027669	0	100	100	100	0	0	1	-360	360
58	96	0.0032702	0.0011777	0	100	100	100	0	0	1	-360	360
73	91	0.0056198	0.0053554	0	100	100	100	0	0	1	-360	360
88	75	0.0033570	0.0012099	0	100	100	100	0	0	1	-360	360
99	77	0.0038231	0.0013835	0	100	100	100	0	0	1	-360	360
108	83	0.0053802	0.0019339	0	100	100	100	0	0	1	-360	360
105	86	0.0067149	0.0024174	0	100	100	100	0	0	1	-360	360
110	118	0.0058587	0.0021099	0	100	100	100	0	0	1	-360	360
25	35	0.0041322	0.0041322	0	100	100	100	0	0	1	-360	360
];

code = [
27  26  25  24  23  22  21  20  19  18  11  10  4   28  29  38  39  40  41  42  43  44  45  46  119
17  16  15  14  13  12  18  19  20  21  22  23  24  25  26  27  120 0   0   0   0   0   0   0   0
24  23  22  21  20  19  18  11  10  4   5   6   7   8   121 0   0   0   0   0   0   0   0   0   0   
43  42  41  40  39  38  30  31  32  33  34  35  47  48  49  50  51  52  53  54  122 0   0   0   0
49  48  47  35  34  33  32  31  30  55  56  57  58  59  60  61  62  123 0   0   0   0   0   0   0

37  36  30  55  56  57  58  59  60  61  62  124 0   0   0   0   0   0   0   0   0   0   0   0   0
9   8   7   6   5   28  29  38  39  40  125 0   0   0   0   0   0   0   0   0   0   0   0   0   0
58  57  56  55  29  28  4   2   63  64  65  89  90  91  96  126 0   0   0   0   0   0   0   0   0
91  90  89  66  67  68  69  70  71  72  73  127 0   0   0   0   0   0   0   0   0   0   0   0   0
75  74  73  72  71  70  69  68  67  66  65  78  79  86  87  88  128 0   0   0   0   0   0   0   0

99  98  97  96  91  90  89  66  67  68  69  70  71  72  73  74  75  76  77  129 0   0   0   0   0
83  82  81  80  79  78  64  63  100 101 102 103 104 105 106 107 108 130 0   0   0   0   0   0   0
86  79  78  64  63  100 101 102 103 104 105 131 0   0   0   0   0   0   0   0   0   0   0   0   0
110 109 108 107 106 105 104 103 102 101 114 115 116 117 118 132 0   0   0   0   0   0   0   0   0
25  24  23  22  21  20  19  18  11  10  4   28  29  30  31  32  33  34  35  133 0   0   0   0   0
];

delete_branch = zeros(15,1);
for i = 1:15
    delete_branch(i,1) = code(i,chorm(i));
end
mpc.branch(delete_branch-1,:)=[];


[branch, voltage] = runpf(mpc);
power_loss        = real(sum(branch(:,14))+sum(branch(:,16)))*1000;
min_v             = 1- real(min(voltage));

